package br.com.conhecimento.core.model;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Modelo de Dados de Acesso.
 * @author Luis Garcia
 */
@Entity
@Table(name = "tb_acesso")
public class GestaoAcesso extends GestaoModeloBase implements Comparable<GestaoAcesso> {

	/** Serial Version. */
	private static final long serialVersionUID = 1L;
	
	@ManyToOne
	@JoinColumn(name="ID_MENU_ITEM", referencedColumnName="ID")
	private GestaoMenuItem menuItem;
	
	public GestaoMenuItem getMenuItem() {
		return menuItem;
	}

	public void setMenuItem(GestaoMenuItem menuItem) {
		this.menuItem = menuItem;
	}

	@Override
	public String toString(){
		return "[Acesso: "+this.getId()+"]";
	}

	@Override
	public int compareTo(GestaoAcesso o) {
		if(this.getId() < o.getId()){
			return -1;
		} else if (this.getId() > o.getId()){
			return 1;
		} else{
			return 0;
		}
	}

}